package io.renren.modules.report.service.impl;

import io.renren.modules.report.entity.BusinessPackageEntity;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.report.dao.DataPackageDao;
import io.renren.modules.report.entity.DataPackageEntity;
import io.renren.modules.report.service.DataPackageService;


@Service("dataPackageService")
public class DataPackageServiceImpl extends ServiceImpl<DataPackageDao, DataPackageEntity> implements DataPackageService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        String packageId = (String)params.get("packageId");
        String userId = (String)params.get("userId");

        IPage<DataPackageEntity> page = this.page(
                new Query<DataPackageEntity>().getPage(params),
                new QueryWrapper<DataPackageEntity>()
                        .eq("user_id", userId)
                        .eq("b_p_id", packageId)
        );

        return new PageUtils(page);
    }

}